<template>
    <div>
        <h1>课程添加</h1>
        <p>请输入课程:<input type="text" v-model="form.name"></p>
        <p>上传图片<van-uploader :after-read="add" /></p>
        <button>添加</button>
        <br/>
        <h1>课程展示</h1>
        <table>
            <tr>
                <td>课程名称</td>
                <td>图片显示</td>
            </tr>
            <tr v-for="i in list">
                <td>{{i.name}}</td>
                <td></td>
            </tr>
        </table>

    </div>
</template>

<script>
    export default {
        data(){
            return{
                form:{},
                list:{}
            }
        },
        methods:{
            add(file){
                  let data = new FormData()
                data.append('file',file.file)
                data.append('name',form.name)
                this.$axios.post('users/add',data).then(res=>{
                    
                })
            },
            get_list(){},
        },
        mounted:{}
        
    }
</script>

<style scoped>

</style>